#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;
/*
Date:20210421 23:21pm
key:1.快排只有中间两个while在key那里有等号
	2.快排中选左作为基准就要从右边开始
	3.swap异或交换如果是同一个变量来源就会双双变成0，谨记！
*/
void swap(int& a, int& b)
{
	if (a != b)
	{
		a = a ^ b;
		b = a ^ b;
		a = a ^ b;
	}

}
void Q(int l, int r, int* A)
{
	if (l < r)
	{
		int i = l;
		int j = r;
		int key = A[l];
		while (i<j)
		{
			while (key <= A[j] && i < j)
			{
				j--;
			}
			while (key >= A[i] && i < j)
			{
				i++;
			}
			if (i < j)
			{

				swap(A[i], A[j]);
			}
		}
		swap(A[i], A[l]);

		Q(l, i-1, A);
		Q(i+1, r, A);
	}
}

int main()
{
	int n;
	cin >> n;
	//8 1 8 2 7 3 6 4 5
	//int a = 1;
	//int b = 1;
	//swap(a, a);
	//cout << a << b;
	int* A = new int[n];
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
	}
	Q(0, n - 1,A);
	for (int i = 0; i < n; i++)
	{
		cout<< A[i]<<" ";
	}
}